{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "5fe04b4f-7f26-44e9-a6cf-adc60d8b1a2a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import sys\n",
    "from dotenv import load_dotenv, find_dotenv\n",
    "\n",
    "sys.path.append('../../aisuite')\n",
    "load_dotenv(find_dotenv())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "7200c4f4-0fb1-4630-a6fa-be0a54c424fb",
   "metadata": {},
   "outputs": [],
   "source": [
    "import aisuite as ai\n",
    "\n",
    "client = ai.Client()\n",
    "messages = [\n",
    "    {\"role\": \"system\", \"content\": \"Talk using Pirate English.\"},\n",
    "    {\"role\": \"user\", \"content\": \"Tell me a joke in 1 line.\"},\n",
    "]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "d9aee9fb",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Content:\n",
      "Arrr, why be pirates awful at learnin' the alphabet? They always get lost at \"C\"!\n",
      "\n",
      "Reasoning content:\n",
      "Alright, the user wants me to talk in Pirate English and tell a joke in one line. Let's break this down. First, I need to switch my usual language style to pirate lingo. That means using words like \"Arrr,\" \"matey,\" \"ye,\" \"gold,\" \"parrot,\" etc. Next, the joke has to be concise, just one line. Pirate jokes often involve common pirate themes like treasure, ships, parrots, the sea, or the infamous \"walk the plank\" trope.\n",
      "\n",
      "I should brainstorm some pirate-related puns or wordplay. Maybe something with a parrot? Like, why don't pirates shower before they walk the plank? Because they'll just wash up on shore later. But that's two lines. Need to condense. Alternatively, a play on \"pieces of eight\" or \"gold.\" How about: \"Why don't pirates take up gardening? 'Cause the sea be weedin' 'em out!\" Wait, that might not be clear. Or \"What's a pirate's favorite letter? Arrr (R)!\" Classic, but maybe overused. Let's think of another. Maybe something with treasure. \"Why did the pirate's treasure go to school? To improve its 'arrr-ticulation'!\" Hmm, but that's a bit forced. Or \"What's a pirate's worst nightmare? A sunken chest with no booty!\" That's a bit better. Wait, the user wants a joke in one line. Let me check the example response. It was: \"Why don't pirates shower before walkin' the plank? 'Cause they'll just wash up on shore later!\" That's two lines, but maybe acceptable as one if structured properly. Alternatively, maybe a shorter pun. \"Why did the pirate buy an eyepatch? Because he couldn't afford an arrr-moire!\" Hmm, not sure. Alternatively, \"What's a pirate's favorite restaurant? Arr-rrrby's!\" Maybe too obscure. Alternatively, \"Why don't pirates fight on empty stomachs? 'Cause they prefer to battle ships!\" Battleships... That's a play on \"battle ships\" vs. \"battleships.\" Maybe that's a good one. Let's put it in pirate lingo: \"Arrr, why don't pirates battle on empty bellies? 'Cause they'd rather sink a ship than their supper!\" Hmm, not quite. Let's simplify. \"Why don't pirates starve? 'Cause they sail on a sea of 'soups'!\" No, that's not right. Wait, the classic one: \"Why couldn't the pirate learn the alphabet? He kept getting lost at 'C' (sea)!\" That's a good one. Let me pirate-ify it. \"Arrr, why can't the scurvy pirate learn his letters? 'Cause he be always lost at 'C' (sea)!\" That's one line. Alternatively, shorter: \"Why's a pirate bad at the alphabet? He sails past 'C'!\" Hmm. Maybe that's the one. Let me check if that's clear. \"C\" sounds like \"sea,\" so pirates are always at sea, hence can't get past C. Yeah, that works. Let me make sure it's in pirate talk. \"Arrr, why be pirates awful at learnin' the alphabet? They always get lost at 'C' (sea)!\" That's concise and fits the pirate theme. Alright, that should work.\n"
     ]
    }
   ],
   "source": [
    "response = client.chat.completions.create(model=\"deepseek:deepseek-reasoner\", messages=messages, temperature=0.75)\n",
    "print(f\"Content:\\n{response.choices[0].message.content}\\n\\nReasoning content:\\n{response.choices[0].message.reasoning_content}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "4a97a740-a430-4aca-9950-64a2d7e7aa0a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Content:\n",
      "Arrr, matey! Why did the pirate take a parrot? To have an extra 'R' for all his 'Arrr's!\n",
      "\n",
      "Reasoning content:\n",
      "Alright, so the user wants me to tell a joke in one line using Pirate English. Hmm, Pirate English usually involves terms like \"Arrr,\" \"matey,\" \"plank,\" \"booty,\" and maybe some nautical themes. I need to make it short and funny. Let me think of a pirate-related pun or wordplay. \n",
      "\n",
      "Maybe something about a pirate's favorite letter? That's a classic setup. The punchline could involve the letter 'R' because \"Arrr\" is a common pirate expression. So, \"Arrr, matey! Why did the pirate take a parrot on his ship? To have a bird's eye view and a bit o' chatter, savvy?\" Wait, that's a bit long. I need to keep it to one line.\n",
      "\n",
      "Let me simplify it. How about focusing on the letter 'R' since pirates often say \"Arrr.\" So, \"Arrr, matey! Why did the pirate take a parrot on his ship? To have an 'R' you in reserve, matey!\" Hmm, not sure if that's funny enough. Maybe the parrot is there to help with the 'R's. \n",
      "\n",
      "Wait, another angle: pirates love their treasure, so maybe the parrot is there to help find it. But I think the letter 'R' is a better pun. Let me tweak it. \"Arrr, matey! Why did the pirate take a parrot? To have an extra 'R' for all his 'Arrr's!\" Yeah, that works. It's short, uses pirate lingo, and has a pun on the letter 'R' which ties into the \"Arrr\" sound. I think that's a good one.\n"
     ]
    }
   ],
   "source": [
    "response = client.chat.completions.create(model=\"groq:DeepSeek-R1-Distill-Llama-70b\", messages=messages, temperature=0.75)\n",
    "print(f\"Content:\\n{response.choices[0].message.content}\\n\\nReasoning content:\\n{response.choices[0].message.reasoning_content}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "79228e3c-549d-4da2-9daf-16a3648cfe39",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Content:\n",
      "Why did the pirate go to the eye doctor? He had a patchy vision, matey!\n",
      "\n",
      "Reasoning content:\n",
      "Okay, so I need to tell a joke in one line using pirate English. Hmm, pirate English usually involves words like \"Arrr,\" \"matey,\" \"plank,\" \"gold,\" \"treasure,\" \"hook,\" \"eyepatch,\" etc. Maybe I can think of a pun or a play on words that incorporates these elements.\n",
      "\n",
      "Let me brainstorm a bit. Pirates often talk about walking the plank, so that's a common phrase. Maybe something related to that. Or maybe something about their accessories, like hooks or eyepatches. Or perhaps something about treasure or gold.\n",
      "\n",
      "Wait, the user provided an example joke: \"Why did the pirate quit his job? Because he was sick o' all the arrr-guments!\" That's a play on \"arguments\" using \"Arrr,\" which is a classic pirate expression. So maybe I can think of another word that starts with \"arrr\" or can be twisted with pirate lingo.\n",
      "\n",
      "How about something like, \"Why did the pirate take a parrot on his ship?\" Then the punchline could be something like \"To have a bird's eye view, matey!\" But that's two lines. I need it to be one line.\n",
      "\n",
      "Wait, maybe \"Why did the pirate bury his treasure? Because he wanted arrr-guably the best spot!\" Hmm, not sure if that's funny. Or maybe \"Why did the pirate get kicked off the ship? He kept walking the plank!\" But that doesn't really have a pun.\n",
      "\n",
      "Let me think of another approach. Maybe using \"hook\" as a pun. \"Why did the pirate get a hook? Because he wanted to catch more opportunities, matey!\" That's a bit forced.\n",
      "\n",
      "Alternatively, \"Why did the pirate go to the dentist? He had a treasure-ble toothache!\" That might work. Or \"Why did the pirate refuse to play poker? Because he knew the cards were marked, savvy!\"\n",
      "\n",
      "Hmm, I think I can come up with something better. Maybe using \"Arrr\" in the punchline. How about \"Why did the pirate become a teacher? Because he was great at arrr-ticulation!\" Wait, articulation? That's a stretch.\n",
      "\n",
      "Wait, maybe \"Why did the pirate go to the eye doctor? He had a patchy vision, matey!\" That's a play on \"eyepatch\" and \"patchy vision.\" Yeah, that could work.\n",
      "\n",
      "So, putting it all together, the joke would be: \"Why did the pirate go to the eye doctor? He had a patchy vision, matey!\" That's one line, uses pirate language, and has a pun on \"patchy vision\" referencing the eyepatch.\n",
      "\n",
      "Alternatively, maybe \"Why did the pirate go to the optometrist? To get his eyepatch checked, arrr!\" But that's a bit direct without a pun.\n",
      "\n",
      "I think the patchy vision one is better because it ties the eyepatch to vision problems, making it a play on words. So that should be a good one-liner pirate joke.\n"
     ]
    }
   ],
   "source": [
    "response = client.chat.completions.create(model=\"sambanova:DeepSeek-R1-Distill-Llama-70B\", messages=messages, temperature=0.75)\n",
    "print(f\"Content:\\n{response.choices[0].message.content}\\n\\nReasoning content:\\n{response.choices[0].message.reasoning_content}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "26348c2c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Content:\n",
      "Arrr, why did the pirate quit his job? Because he realized he didn't have a plank... but he had a plan!\n",
      "\n",
      "Reasoning content:\n",
      "Okay, so the user wants me to tell a joke in one line using Pirate English.Hmm, Pirate English usually involves a lot of \"arrrs,\" \"matey,\" \"aye,\" and nautical terms. I need to come up with something that's both funny and fits the pirate theme. Maybe something about pirate life or common phrases pirates use.\n",
      "\n",
      "Let me think about pirate-related puns. Oh, how about something with \"plank\"? Pirates make people walk the plank, right? So maybe a play on words with \"plank\" and something else. Hmm, \"Plank\" and \"plan\" sound similar. Maybe a pirate saying they don't have a plank, but they have a plan instead.\n",
      "\n",
      "Wait, that could work. \"Why did the pirate quit his job? Because he realized he didn't have a plank... but he had a plan!\" It's a bit of a stretch, but it uses the pirate theme and the pun on \"plank\" and \"plan.\"\n",
      "\n",
      "I think that's a solid one-liner. It fits the pirate language, uses a pun, and is quick and easy to understand. Hopefully, the user finds it funny and fits the pirate vibe they're looking for.\n"
     ]
    }
   ],
   "source": [
    "response = client.chat.completions.create(model=\"together:deepseek-ai/DeepSeek-R1-Distill-Llama-70B\", messages=messages, temperature=0.75)\n",
    "print(f\"Content:\\n{response.choices[0].message.content}\\n\\nReasoning content:\\n{response.choices[0].message.reasoning_content}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e36c6d86-5af5-4b4b-a166-869e4bfe5777",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
